package com.example.business_oa.controller;

import com.example.business_oa.service.PosService;
import com.example.business_oa.service.QiDongDingDanService;
import com.example.business_oa.service.SelectLeaderService;
import com.example.comment_oa.pojos.SysEmployee;
import com.example.comment_oa.pojos_vo.LogisticsVo.PosVo;
import com.example.comment_oa.response.AjaxResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@CrossOrigin
@RequestMapping("/businessOa")
public class QiDongDingDanController {
    @Resource
    QiDongDingDanService qiDongDingDanService;
    @Resource
    SelectLeaderService selectLeaderService;

    @Resource
    PosService posService;


    @PostMapping("/qidongDingDanLiuCheng")
    public AjaxResponse qidongDingDanLiuCheng(@RequestBody PosVo posVo){

        posService.AddIndent(posVo);
        //工号+"+"+订单号
        System.err.println(posVo.getEmpCard()+"+++"+posVo.getPosNo());
//        System.err.println(designVo);
        //这个是关于流程的
        HashMap<String, Object> variables = new HashMap<>();
        SysEmployee sysEmployee = selectLeaderService.selectGongHao(posVo.getEmpCard());
        String assignee1 = sysEmployee.getEmpCard();
        //要一个工号 ：是发起人的
        // 一个编号 是 ：主键

        qiDongDingDanService.qidongDingDanLiuCheng(posVo.getEmpCard(),variables,assignee1,posVo.getPosNo());
        return AjaxResponse.success(true);
    }

}
